package com.foreknow.util;

import com.foreknow.model.Guestbook;

import java.util.List;

public class DataFormatConvert {
    /**
     * 将集合转换为二维数组
     */
    public Object[][] convert(List<Object> list) {
        Object[][] tableData = new Object[list.size()][7];
        for(int i = 0;i<list.size();i++){
            Guestbook gb = (Guestbook) list.get(i);
            tableData[i][0] = gb.getId();
            tableData[i][1] = gb.getName();
            tableData[i][2] = gb.getPhone();
            tableData[i][3] = gb.getEmail();
            tableData[i][4] = gb.getTitle();
            tableData[i][5] = gb.getContent();
            tableData[i][6] = gb.getCreatedtime();
        }
        return tableData;
    }
}
